import request from '@/plugins/request'

/*
 * 登录
 * */
export function AccountLogin(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

/**
 * 退出登陆
 * @constructor
 */
export function AccountLogout() {
  return request({
    url: '/setting/admin/logout',
    method: 'get'
  })
}

/**
 * 获取轮播图和logo
 */
export function loginInfoApi() {
  return request({
    url: '/login/info',
    method: 'get'
  })
}

/**
 * 获取菜单数据
 */
export function menusApi() {
  return request({
    url: '/menus',
    method: 'get'
  });
}

/**
 * 搜索菜单数据
 */
export function menusListApi() {
  return request({
    url: '/menusList',
    method: 'get'
  });
}

// 用户注册
export function accountRegister(data) {
  return request({
    url: '/register',
    method: 'post',
    data
  })
}

// 发送验证码
export function SendCodeApi(data) {
  return request({
    url: '/register/send_email',
    method: 'post',
    data
  })
}

// 发送登录验证码
export function SendLoginCodeApi(data) {
  return request({
    url: '/login/send_email',
    method: 'post',
    data
  })
}

// 是否管理员
export function IsAdmin() {
  return request({
    url: '/setting/is_admin',
    method: 'get'
  })
}

// 验证用户名是否存在
export function CheckUserName(data) {
  return request({
    url: '/check_user_name',
    method: 'post',
    data
  })
}

// 验证邮箱是否存在
export function CheckEmail(data) {
  return request({
    url: '/check_email',
    method: 'post',
    data
  })
}